package com.xiao.ztree.core.base;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiao.ztree.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * description: BaseQuery
 * date: 2021/4/29 22:36
 * author: XiaoCoder
 * version: 1.0
 */
@Data
public class BaseQuery<T extends BaseEntity> implements Serializable {
    /**
     * 开始日期
     */
    @ApiModelProperty(value = "开始日期", hidden = true)
    private String startDate;

    /**
     * 结束日期
     */
    @ApiModelProperty(value = "结束日期", hidden = true)
    private String endDate;

    /**
     * 排序属性
     */
    @ApiModelProperty(value = "排序属性", hidden = true)
    private String prop;

    /**
     * 排序方式：asc,desc
     */
    @ApiModelProperty(value = "排序方式", hidden = true)
    private String order;

    /**
     * 当前页
     */
    @ApiModelProperty(value = "当前页")
    private Long current = 0L;

    /**
     * 每页的数量
     */
    @ApiModelProperty(value = "每页的数量")
    private Long size = 20L;

    /**
     * mybatis-plus分页对象
     *
     * @return
     */
    public IPage<T> page() {
        return new Page<>(this.current, this.size);
    }
}

